﻿using System.Collections.Generic;
using UnityEngine;


namespace RStudio.Elevator
{
    /// <summary>
    /// 模块|电梯楼层方案库
    /// </summary>
    public class ElevatorModulePlan
    {
        public ElevatorModulePlan()
        {
            this.PlanDic = new Dictionary<string, PlanElevator>();
        }


        /// <summary>
        /// 数据缓存|方案数据
        /// </summary>
        public Dictionary<string, PlanElevator> PlanDic { get; private set; }


        /// <summary>
        /// 注册
        /// </summary>
        /// <param name="plan"></param>
        public void Register(PlanElevator plan)
        {
            this.PlanDic.TryAdd(plan.Name.ToUpper(), plan);
            Debug.Log($"<b>[ElevatorModulePlan]</b> {plan.Name} 注册了电梯参数中心");
        }

        /// <summary>
        /// 获取
        /// </summary>
        public PlanElevator Get(string key)
        { 
            return this.PlanDic.TryGetValue(key, out PlanElevator output) == true ? output : null;        
        }
    }
}
